<!DOCTYPE html>
<div id="start">xx</div>
<div style="position: relative; font-family: monospace">
  <div style="display: inline-block">inline block inside selection root</div>
</div>
<div id="end">xx</div>
<script>

var start = document.querySelector('#start'),
    end = document.querySelector('#end');
getSelection().setBaseAndExtent(start.firstChild, 0, end.firstChild, 2);
focus();

</script>
